package org.pupil.common;

import java.util.Objects;

/**
 * @Description: 服务，记录服务的信息
 * @Author: pupil
 * @Date: 2024/07/10 下午 4:17
 */
public class Service {
    private final String name; // 服务名
    private final String version; // 服务版本

    public Service(String name, String version) {
        this.name = name;
        this.version = version;
    }

    @Override
    public String toString() {
        return "Service{" +
                "name='" + name + '\'' +
                ", version='" + version + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Service that = (Service) o;
        return Objects.equals(name, that.name) && Objects.equals(version, that.version);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, version);
    }
}
